<!DOCTYPE html>
<html><head>
	    <meta charset="utf-8">
    <title>111111111111111111111</title>

    <meta name="description" content="Dashboard">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <!--Basic Styles-->
    <link href="__PUBLIC__/style/bootstrap.css" rel="stylesheet">
    <link href="__PUBLIC__/style/font-awesome.css" rel="stylesheet">
    <link href="__PUBLIC__/style/weather-icons.css" rel="stylesheet">

    <!--Beyond styles-->
    <link id="beyond-link" href="__PUBLIC__/style/beyond.css" rel="stylesheet" type="text/css">
    <link href="__PUBLIC__/style/demo.css" rel="stylesheet">
    <link href="__PUBLIC__/style/typicons.css" rel="stylesheet">
    <link href="__PUBLIC__/style/animate.css" rel="stylesheet">
	
	<!--引入百度编辑器uidetor-->
	 <script src="__PUBLIC__/ueditor/ueditor.config.js"></script>
	 <script src="__PUBLIC__/ueditor/ueditor.all.min.js"></script>
	 <script src="__PUBLIC__/ueditor/lang/zh-cn/zh-cn.js"></script>
    
</head>
<body>
	<!-- 头部 -->
	<include file="Common/header"/>

	<!-- /头部 -->
	
	<div class="main-container container-fluid">
		<div class="page-container">
			            <!-- Page Sidebar -->
            <include file ="Common/left" />
            <!-- /Page Sidebar -->
            <!-- Page Content -->
            <div class="page-content">
                <!-- Page Breadcrumb -->
                <div class="page-breadcrumbs">
                    <ul class="breadcrumb">
                                        <li>
                        <a href="#">系统</a>
                    </li>
                                        <li>
                        <a href="__MODULE__/Goods/lst">商品列表</a>
                    </li>
                                        <li class="active">添加商品</li>
                                        </ul>
                </div>
                <!-- /Page Breadcrumb -->

                <!-- Page Body -->
                <div class="page-body">
                    
<div class="row">
    <div class="col-lg-12 col-sm-12 col-xs-12">
        <div class="widget">
            <div class="widget-header bordered-bottom bordered-blue">
                <span class="widget-caption">新增商品</span>
            </div>
            <div class="widget-body">
                <div id="horizontal-form">
                    <form class="form-horizontal" role="form" action="" method="post" enctype="multipart/form-data" >
                      <!---11111111111111111111111111111-->
					  <div class="tabbable">
								<ul class="nav nav-tabs tabs-flat" id="myTab11">
									<li class="active">
										<a data-toggle="tab" href="#home11">
											基本信息
										</a>
									</li>
									<li>
										<a data-toggle="tab" href="#profile11">
											商品描述
										</a>
									</li>
									<li>
										<a data-toggle="tab" href="#profile12">
											会员价格
										</a>
									</li>
									<li>
										<a data-toggle="tab" href="#profile13">
											商品属性
										</a>
									</li>
									<li>
										<a data-toggle="tab" href="#profile14">
											商品图片
										</a>
									</li>
								</ul>
								
									
									<div class="tab-content tabs-flat">
									<div id="home11" class="tab-pane active">
										

										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品名称</label>
												<div class="col-sm-6">
													<input class="form-control" placeholder="" name="goods_name"   type="text"/>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品缩略图</label>
												<div class="col-sm-6">
													<input   placeholder="" name="original"   type="file"/>
												</div>		
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品所属分类</label>
												<div class="col-sm-6">
													<select name="cate_id">
														<option>请选择</option>
														<volist name="cateres" id="vo">
																<option value="{$vo.id}"><?php echo str_repeat('----', $vo['level']); ?>{$vo.cate_name}</option>
														</volist>
													</select>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品所属品牌</label>
												<div class="col-sm-6">
													<select name="brand_id">
															<option>请选择</option>
															<volist name="brandres" id="vo">
																	<option value="{$vo.id}">{$vo.brand_name}</option>
															</volist>
													</select>
												</div>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">市场价格</label>
												<div class="col-sm-6">
													<input class="form-control"  placeholder="" name="market_price"   type="text"/>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">本店价格</label>
												<div class="col-sm-6">
													<input class="form-control" placeholder="" name="shop_price"   type="text"/>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品重量</label>
												<div class="col-sm-6">
													<input class="form-control" placeholder="" name="goods_weight"   type="text" style="width:60%; float:left; "/>
													<select style="margin-left:20px" name="weight_unit">
														<option value="g">克</option>
														<option value="kg">千克</option>
													</select>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">是否上架</label>
												<div class="col-sm-6">
													<div class="checkbox">
                                                        <label>
                                                            <input type="checkbox" class="colored-success" checked="checked" name="onsale">
                                                            <span class="text">上架</span>
                                                        </label>
                                                    </div>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">设置推荐</label>
												<div class="col-sm-6">
													<div class="checkbox">
														<volist name="recpos" id="vo">
															<label style="margin-right:10px">
																<input type="checkbox" class="colored-success" name="recid[]" value="{$vo.id}">
																<span class="text">{$vo.recname}</span>
															</label>
														</volist>
                                                    </div>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
									</div>
									
									<div id="profile11" class="tab-pane">
										<textarea id="goods_desc" name="goods_desc"></textarea>
									</div>
									<div id="profile12" class="tab-pane">
									<volist name="levres" id="vo">
									<div class="form-group">
											<label for="username" class="col-sm-2 control-label no-padding-right" >{$vo.level_name}</label>
											<div class="col-sm-6">
											<input class="form-control" name="mp[{$vo.id}]" type="text"/>
											</div>
											<p class="help-block col-sm-4 red">* 必填</p>
									</div>
									</volist>
									</div>
									
									<div id="profile13" class="tab-pane">
										<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">商品类型</label>
												<div class="col-sm-6">
													<select name="type_id">
														<volist name="typeres" id="vo">
																<option value="{$vo.id}">{$vo.type_name}</option>
														</volist>
													</select>
												</div>
												<p class="help-block col-sm-4 red">* 必填</p>
										</div>
										
										<div  id="attr"></div>
										
									</div>
									
									<div id="profile14" class="tab-pane">
									<div class="form-group">
												<label for="username" class="col-sm-2 control-label no-padding-right">
													<a href="javascript:;" id="addImg">[+]</a>.
												</label>
												<div class="col-sm-6">
													<input   name="goods_price[]"   type="file"/>
												</div>
												
										</div>
									</div>		
								</div>
							</div>
								<input type="submit" class="btn btn-darkorange btn-block" value="提交"  style="width:150px">
					   <!---11111111111111111111111111111-->
					   <!---11111111111111111111111111111-->
                    </form>
                </div>
            </div>
        </div>
    </div>
</div>

                </div>
                <!-- /Page Body -->
            </div>
            <!-- /Page Content -->
		</div>	
	</div>

	    <!--Basic Scripts-->
    <script src="__PUBLIC__/style/jquery_002.js"></script>
    <script src="__PUBLIC__/style/bootstrap.js"></script>
    <script src="__PUBLIC__/style/jquery.js"></script>
    <!--Beyond Scripts-->
    <script src="__PUBLIC__/style/beyond.js"></script>
	<script type="text/javascript">

    //实例化编辑器
    //建议使用工厂方法getEditor创建和引用编辑器实例，如果在某个闭包下引用该编辑器，直接调用UE.getEditor('editor')就能拿到相关的实例
    UE.getEditor('goods_desc',{initialFrameWidth:1000,initialFrameHeight:300,});
    
		var str='<div class="form-group"><label for="username" class="col-sm-2 control-label no-padding-right"><a  onclick="delImg(this);" href="javascript:;" id="addImg">[-]</a></label><div class="col-sm-6"><input   name="goods_pics[]"   type="file"/></div></div>';
	
		$("#addImg").click(function(){
			$("#profile14").append(str);
		});
		
		function delImg(o){
			$(o).parent().parent().remove();
		}
		
		function attrad(o){
		var div=$(o).parent().parent();
			if($(o).html() =='[+]'){
				var newdiv=div.clone();
				newdiv.find('a').html('[-]');
				div.after(newdiv);
			}else{
				div.remove();
			}
		}
		
		$("select[name=type_id]").change(function(){
			var  typeid=$(this).val();
			$.ajax({
				type:"GET",
				url:"__CONTROLLER__/ajaxgetattr/typeid/"+typeid,
				dataType:"json",
			//	success:function(data){
			//		var html=' ';
			//		$(data).each(function(k,v){	
			//			html+="<div class='form-group'><label for='username' class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label><div class='col-sm-6'><input class='form-control' type='text' /></div></div>";
			//		});
			//		$("#attr").html(html);		
			//	}
				
				success : function(data){
					var html="";
					$(data).each(function(k,v){	
					//	html+="<div class='form-group'><label for='username' class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label><div class='col-sm-6'><input class='form-control' type='text' /></div></div>";
					if(v.attr_type=='1'){
						var attrs=v.attr_values.split(",");
						html+="<div class='form-group'><label  class='col-sm-2 control-label no-padding-right'><a href='javascript:;' onclick='attrad(this);'>[+]</a>"+v.attr_name+"</label><div class='col-sm-6'>";
						html+="<select name='goods_attr["+v.id+"][]'><option>请选择</option>";
						for(var i=0; i<attrs.length; i++){
						html+="<option>"+attrs[i]+"</option>";
						}
						html+="</select><span>￥<input type='text' sytle='padding:4px 12px; width:70px; height:20px' value='0.00' name='goods_price[]'>元</span>";
						html+="</div></div>";
					}else{
						if(v.attr_values !=''){
							var attrs=v.attr_values.split(",");
							html+="<div class='form-group'><label  class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label><div class='col-sm-6'>";
							html+="<select name='goods_attr["+v.id+"]'><option>请选择</option>";
							for(var i=0; i<attrs.length; i++){
							html+="<option>"+attrs[i]+"</option>";
							}
							html+="</select><input type='hidden' sytle='padding:4px 12px; width:70px; height:20px' value='0.00' name='goods_price[]'>";
							html+="</div></div>";
						}else{
							html+="<div class='form-group'><label for='username' class='col-sm-2 control-label no-padding-right'>"+v.attr_name+"</label><div class='col-sm-6'><input class='form-control' type='text'  name='goods_attr["+v.id+"]'/><input type='hidden' sytle='padding:4px 12px; width:70px; height:20px' value='0.00' name='goods_price[]'></div></div>";
						}
					}
					
					});
					$("#attr").html(html);		
				}	
				
				
				
			});
		});

</script>

</body></html>